package com.hifar.test.syncData.controller;

import com.hifar.test.syncData.pojo.VO.SyncImportVO;
import com.hifar.test.syncData.service.ISyncDataService;
import com.hifar.sys.BusiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhuWeiWei
 * @description TODO
 * @date 2025/4/11 10:02
 */
@RestController
@RequestMapping("/api/busi/test/syncData")
@Api(tags = "双网同步-导出表功能")
public class SyncDataController {

    @Autowired
    private ISyncDataService syncDataService;

    @GetMapping(value = "/exportData")
    @ApiOperation(value = "双网同步-导出数据")
    public BusiResponse exportData() {
        syncDataService.exportData();
        return BusiResponse.OK();
    }


    @PostMapping(value = "/importData")
    @ApiOperation(value = "双网同步-导入数据")
    public BusiResponse importData(@RequestBody @Validated SyncImportVO syncImportVO) {
        String fileId = syncImportVO.getFileId();
        syncDataService.importData(fileId);
        return BusiResponse.OK();
    }
}
